import re

class Landblock:

	def __init__(self,row,column,ltype,secondary='regular'):
		self.row=row
		self.column=column
		factionBase=re.match('(\w+)(\d)',ltype)
		faction=None
		if(factionBase):
			faction=int(factionBase.group(2))
			ltype=str(factionBase.group(1))
		captureCost=None
		if((ltype=='city') or (ltype=='HQ') or (ltype=='base')):
			captureCost=20
		self.captureCost=captureCost
		self.ltype=ltype
		self.faction=faction
		self.unit=None
		self.secondary=secondary
		return

	def getRow(self):
		return(self.row)
	def getColumn(self):
		return(self.column)
	def getlType(self):
		return(self.ltype)
	def getFaction(self):
		return(self.faction)
	def setFaction(self,faction):
		self.faction=faction
	def setlType(self,ltype):
		self.ltype=ltype
	def setUnit(self,unit):
		self.unit=unit
		return
	def getCaptureCost(self):
		return(self.captureCost)
	def setCaptureCost(self,captureCost):
		self.captureCost=captureCost
	def getUnit(self):
		return(self.unit)
	def setSecondary(self,secondary):
		self.secondary=secondary
		return
	def getSecondary(self):
		return(self.secondary)
	def __repr__(self):
		return(''.join(['(row=',str(self.row),', column=',str(self.column),', lType=',self.ltype,', unit=',str(self.unit),')'])) 
